'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event  
	const {user, title, center, answers, rightAnswer , analysis, type, city,typesss="前端" } = event  // 从客户传过来的值
	
	let test = {
		"title":title,
		"center":center,
		"answers":answers,
		"rightAnswer":rightAnswer,
		"analysis":analysis,
		"type":type,
		"city":city,
		"typesss":typesss
	}
	
	const add_test = await db.collection('test').add(test)
	
	//返回数据给客户端
	return {
		status: 200,
		msg: '数据添加成功',
		data:add_test
		}
};


// 生成comment_idid值
function getID(length){
	return Number(Math.random().toString().substr(3,length) + Date.now()).toString(36)
}
